package com.ruicar.afs.cloud.basic.proceeds.pay.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentPool;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentPoolDetails;
import com.ruicar.afs.cloud.basic.proceeds.pay.mapper.BasicPaymentPoolDetailsMapper;
import com.ruicar.afs.cloud.basic.proceeds.pay.service.BasicPaymentPoolDetailsService;
import org.springframework.stereotype.Service;

import java.util.Calendar;

/**
 * @author: Lee
 * @date 2020-05-30 04:35:07 
 * @description 
 */
@Service
public class BasicPaymentPoolDetailsServiceImpl extends ServiceImpl<BasicPaymentPoolDetailsMapper, BasicPaymentPoolDetails> implements BasicPaymentPoolDetailsService {

    @Override
    public void paySuccess(BasicPaymentPool pool) {
        this.update(Wrappers.<BasicPaymentPoolDetails>update().lambda()
                .eq(BasicPaymentPoolDetails::getPoolId,pool.getId())
                .set(BasicPaymentPoolDetails::getPaymentSuccessTime, Calendar.getInstance().getTime())
        );
    }

    @Override
    public void changeAccount(BasicPaymentPool pool) {
        this.update(Wrappers.<BasicPaymentPoolDetails>update().lambda()
                .eq(BasicPaymentPoolDetails::getPoolId,pool.getId())
                .set(BasicPaymentPoolDetails::getReceiptBankCode,pool.getReceiptBankCode())
                .set(BasicPaymentPoolDetails::getReceiptBankName,pool.getReceiptBankName())
                .set(BasicPaymentPoolDetails::getReceiptAccount,pool.getReceiptAccount())
                .set(BasicPaymentPoolDetails::getReceiptAccountName,pool.getReceiptAccountName())
                .set(BasicPaymentPoolDetails::getReceiptEbankCode,pool.getReceiptEbankCode())
        );
    }
}
